<html>
   <head>
      <link rel="stylesheet" type="text/css" href="style.css" />
   </head>
   <body onload="">
<h2 class="comptitle">Simple Module <i>TurtleMobility</i></h2>
<b>Package:</b> org.mixim.modules.mobility<br/><b>File: <a href="modules-mobility-TurtleMobility.ned.html">modules/mobility/TurtleMobility.ned</a></b><br/><p><a href="../doxy/a00200.html" target="mainframe"><b>C++ definition</b></a></p>

<p>A LOGO-style movement model, with the script coming from XML. It can be
useful for describing random as well as deterministic scenarios.</p>
<p>First, a few examples.</p>
<p>Node will move along a square's borders:</p>
<p><pre>
    &lt;movement&gt;
        &lt;set speed=&quot;10&quot; angle=&quot;180&quot;/&gt;
        &lt;repeat n=&quot;4&quot;&gt;
            &lt;forward d=&quot;50&quot;/&gt;
            &lt;turn angle=&quot;90&quot;/&gt;
        &lt;/repeat&gt;
    &lt;/movement&gt;
</pre></p>
<p><a href="org.mixim.modules.mobility.MassMobility.html">MassMobility</a> (in which the node is assumed to have a mass, and cannot turn
abruptly):</p>
<p><pre>
    &lt;movement&gt;
        &lt;repeat&gt;
            &lt;set speed=&quot;uniform(10,20)&quot;/&gt;
            &lt;turn angle=&quot;uniform(-30,30)&quot;/&gt;
            &lt;forward t=&quot;uniform(0.1,1)&quot;/&gt;
        &lt;/repeat&gt;
    &lt;/movement&gt;
</pre></p>
<p>Random Waypoint:</p>
<p><pre>
    &lt;movement&gt;
        &lt;repeat&gt;
            &lt;set speed=&quot;uniform(20,60)&quot;/&gt;
            &lt;moveto x=&quot;uniform(0,\$MAXX)&quot; y=&quot;uniform(0,\$MAXY)&quot;/&gt;
        &lt;/repeat&gt;
    &lt;/movement&gt;
</pre></p>
<p>Commands (XML element names) are: repeat, set, forward, turn, wait,
moveto, and moveby.</p>
<p>Accepted attributes:</p>
  <ul><ul><li>repeat: n (optional)</li>
  <li>set: x, y, speed, angle, borderPolicy (all optional)</li>
  <li>forward: d, t (at last one of them must be present)</li>
  <li>turn: angle (required)</li>
  <li>wait: t (required)</li>
  <li>moveto: x, y, t (all optional)</li>
  <li>moveby: x, y, t (all optional)</li></ul></ul>
<p>Attribute values can be literal numbers (e.g. x="100"), or any
distribution accepted in omnetpp.ini (e.g. speed="uniform(10,20)").
A new value will be chosen each time the statement is executed.
The \$MAXX and \$MAXY strings will be substituted with the
playground width and height minus 1, respectively.</p>
<p>t is time interval, calculated from the end of the previous movement.
x, y are absolute coordinates with &lt;set&gt; and &lt;moveto&gt;, and relative
with &lt;moveby&gt;. angle is clockwise in degrees, with 0 pointing west.
d is distance in meters (speed is m/s).</p>
<p>borderPolicy controls what happens when a node reaches the edge of the
playground, and can take one of the values "reflect", "wrap",
"placerandomly". In the first case, the node reflects off the wall;
with "wrap", it'll come in on the other side (torus); and with
"placerandomly", it will be placed at a random position on the
playground.</p>
<p>In addition to the node position, the module maintains two interval variables,
'speed' and 'angle', which can be adjusted by &lt;set&gt; and &lt;turn&gt;.
The &lt;forward&gt; statement, if only t or d is given, uses the speed variable.
If you specify d and t together, that determines speed as well,
so the speed variable will be ignored completely.</p>
<p>Likewise, &lt;moveto&gt; and &lt;moveby&gt; will ignore the angle variable,
and will only use the speed variable if the t attribute is omitted.</p>
<p>If the repeat count n is omitted for the &lt;repeat&gt; statement, that
means an infinite loop.</p>
<p>You can find the DTD with the sources: <a href="org.mixim.modules.mobility.TurtleMobility.html">TurtleMobility</a>.dtd.</p>
<p>NOTE: Does not yet support 3-dimensional movement.</p>
<p><b>See also:</b> <a href="org.mixim.base.connectionManager.ConnectionManager.html">ConnectionManager</a></p>
<p><b>Author:</b> Andras Varga</p>
<img src="org.mixim.modules.mobility.TurtleMobility-type.png" ismap="yes" usemap="#type-diagram"/><map name="type-diagram">
<area shape="rect" href="org.mixim.modules.mobility.TurtleMobility.html" title="TurtleMobility" alt="TurtleMobility" coords="0,0,132,40">
</map>
<h3 class="subtitle">Usage diagram:</h3>
<p>The following diagram shows usage relationships between types.
Unresolved types are missing from the diagram. Click <a href="full-ned-usage-diagram.html">here</a> to see the full picture.</p>
<img src="org.mixim.modules.mobility.TurtleMobility-usage.png" ismap="yes" usemap="#usage-diagram"/><map name="usage-diagram"><area shape="rect" id="node1" href="org.mixim.modules.mobility.TurtleMobility.html" title="Simple Module TurtleMobility" alt="" coords="5,6,104,34">
</map>
<h3 class="subtitle">Inheritance diagram:</h3>
<p>The following diagram shows inheritance relationships for this type.
Unresolved types are missing from the diagram. Click <a href="full-ned-inheritance-diagram.html">here</a> to see the full picture.</p>
<img src="org.mixim.modules.mobility.TurtleMobility-inheritance.png" ismap="yes" usemap="#inheritance-diagram"/><map name="inheritance-diagram"><area shape="rect" id="node1" href="org.mixim.modules.mobility.TurtleMobility.html" title="Simple Module TurtleMobility" alt="" coords="5,83,104,111">
<area shape="rect" id="node2" href="org.mixim.base.modules.BaseMobility.html" title="Simple Module BaseMobility" alt="" coords="7,6,103,34">
</map>
<h3 class="subtitle">Extends:</h3>
<table>
<tr>
   <td>
      <a href="org.mixim.base.modules.BaseMobility.html">BaseMobility</a>
      <i> (simple&nbsp;module)</i>
   </td>
   <td>

<p>Module which is responsible for mobility
related information like position and movement
<a href="org.mixim.base.modules.BaseMobility.html">BaseMobility</a> itself defines a static mobility
pattern (means only a position, no movement).
Mobility modules which extend from this module
will define more complex movement patterns.</p>
   </td>
</tr>
</table>
<h3 class="subtitle">Parameters:</h3>
<table class="paramtable">
   <tr>
      <th>Name</th>
      <th>Type</th>
      <th>Default value</th>
      <th>Description</th>
   </tr>
<tr class="inherited">
   <td width="150">notAffectedByHostState</td>
   <td width="100">
      <i>bool</i>
   </td>
   <td width="120">true</td>
   <td>   </td>
</tr>
<tr class="inherited">
   <td width="150">coreDebug</td>
   <td width="100">
      <i>bool</i>
   </td>
   <td width="120"></td>
   <td>
<p>debug switch for the core framework</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">x</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120"></td>
   <td>
<p>x coordinate of the nodes' position (-1 = random)</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">y</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120"></td>
   <td>
<p>y coordinate of the nodes' position (-1 = random)</p>
   </td>
</tr>
<tr class="inherited">
   <td width="150">z</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120"></td>
   <td>
<p>z coordinate of the nodes' position (-1 = random)</p>
   </td>
</tr>
<tr class="local">
   <td width="150">debug</td>
   <td width="100">
      <i>bool</i>
   </td>
   <td width="120"></td>
   <td>
<p>debug switch</p>
   </td>
</tr>
<tr class="local">
   <td width="150">turtleScript</td>
   <td width="100">
      <i>xml</i>
   </td>
   <td width="120"></td>
   <td>
<p>describes the movement</p>
   </td>
</tr>
<tr class="local">
   <td width="150">updateInterval</td>
   <td width="100">
      <i>double</i>
   </td>
   <td width="120"></td>
   <td>
<p>time interval to update the hosts position (in seconds)</p>
   </td>
</tr>
</table>
<h3 class="subtitle">Properties:</h3>
<table class="paramtable">
   <tr>
      <th>Name</th>
      <th>Value</th>
      <th>Description</th>
   </tr>
<tr>
   <td width="150">display</td>
   <td width="100"><i>i=block/cogwheel</i></td>
   <td></td>
</tr>
<tr>
   <td width="150">class</td>
   <td width="100"><i>TurtleMobility</i></td>
   <td></td>
</tr>
</table>
<h3 class="subtitle">Source code:</h3>
<pre class="src"><span style="color: #808080; font-style: italic; ">//
// A LOGO-style movement model, with the script coming from XML. It can be
// useful for describing random as well as deterministic scenarios.
//
// First, a few examples.
//
// Node will move along a square's borders:
//
// </span><span style="color: #800000; ">&lt;pre&gt;</span><span style="color: #808080; font-style: italic; ">&lt;nohtml&gt;
//     &lt;movement&gt;
//         &lt;set speed=&quot;10&quot; angle=&quot;180&quot;/&gt;
//         &lt;repeat n=&quot;4&quot;&gt;
//             &lt;forward d=&quot;50&quot;/&gt;
//             &lt;turn angle=&quot;90&quot;/&gt;
//         &lt;/repeat&gt;
//     &lt;/movement&gt;
// &lt;/nohtml&gt;</span><span style="color: #800000; ">&lt;/pre&gt;</span><span style="color: #808080; font-style: italic; ">
//
// MassMobility (in which the node is assumed to have a mass, and cannot turn
// abruptly):
//
// </span><span style="color: #800000; ">&lt;pre&gt;</span><span style="color: #808080; font-style: italic; ">&lt;nohtml&gt;
//     &lt;movement&gt;
//         &lt;repeat&gt;
//             &lt;set speed=&quot;uniform(10,20)&quot;/&gt;
//             &lt;turn angle=&quot;uniform(-30,30)&quot;/&gt;
//             &lt;forward t=&quot;uniform(0.1,1)&quot;/&gt;
//         &lt;/repeat&gt;
//     &lt;/movement&gt;
// &lt;/nohtml&gt;</span><span style="color: #800000; ">&lt;/pre&gt;</span><span style="color: #808080; font-style: italic; ">
//
// Random Waypoint:
//
// </span><span style="color: #800000; ">&lt;pre&gt;</span><span style="color: #808080; font-style: italic; ">&lt;nohtml&gt;
//     &lt;movement&gt;
//         &lt;repeat&gt;
//             &lt;set speed=&quot;uniform(20,60)&quot;/&gt;
//             &lt;moveto x=&quot;uniform(0,$MAXX)&quot; y=&quot;uniform(0,$MAXY)&quot;/&gt;
//         &lt;/repeat&gt;
//     &lt;/movement&gt;
// &lt;/nohtml&gt;</span><span style="color: #800000; ">&lt;/pre&gt;</span><span style="color: #808080; font-style: italic; ">
//
// Commands (XML element names) are: repeat, set, forward, turn, wait,
// moveto, and moveby.
//
// Accepted attributes:
//    - repeat: n (optional)
//    - set: x, y, speed, angle, borderPolicy (all optional)
//    - forward: d, t (at last one of them must be present)
//    - turn: angle (required)
//    - wait: t (required)
//    - moveto: x, y, t (all optional)
//    - moveby: x, y, t (all optional)
//
// Attribute values can be literal numbers (e.g. x=&quot;100&quot;), or any
// distribution accepted in omnetpp.ini (e.g. speed=&quot;uniform(10,20)&quot;).
// A new value will be chosen each time the statement is executed.
// The $MAXX and $MAXY strings will be substituted with the
// playground width and height minus 1, respectively.
//
// t is time interval, calculated from the end of the previous movement.
// x, y are absolute coordinates with &lt;set&gt; and &lt;moveto&gt;, and relative
// with &lt;moveby&gt;. angle is clockwise in degrees, with 0 pointing west.
// d is distance in meters (speed is m/s).
//
// borderPolicy controls what happens when a node reaches the edge of the
// playground, and can take one of the values &quot;reflect&quot;, &quot;wrap&quot;,
// &quot;placerandomly&quot;. In the first case, the node reflects off the wall;
// with &quot;wrap&quot;, it'll come in on the other side (torus); and with
// &quot;placerandomly&quot;, it will be placed at a random position on the
// playground.
//
// In addition to the node position, the module maintains two interval variables,
// 'speed' and 'angle', which can be adjusted by &lt;set&gt; and &lt;turn&gt;.
// The &lt;forward&gt; statement, if only t or d is given, uses the speed variable.
// If you specify d and t together, that determines speed as well,
// so the speed variable will be ignored completely.
//
// Likewise, &lt;moveto&gt; and &lt;moveby&gt; will ignore the angle variable,
// and will only use the speed variable if the t attribute is omitted.
//
// If the repeat count n is omitted for the &lt;repeat&gt; statement, that
// means an infinite loop.
//
//
//
// You can find the DTD with the sources: TurtleMobility.dtd.
//
// NOTE: Does not yet support 3-dimensional movement.
// </span><span style="color: #000080; ">@see</span><span style="color: #808080; font-style: italic; "> ConnectionManager
// </span><span style="color: #000080; ">@author</span><span style="color: #808080; font-style: italic; "> Andras Varga
//
</span><span style="color: #800000; font-weight: bold; ">simple</span><span style="color: #000000; "> </span><span style="color: #000000; ">TurtleMobility</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">extends</span><span style="color: #000000; "> </span><span style="color: #000000; ">BaseMobility</span><span style="color: #000000; ">
{
    </span><span style="color: #800000; font-weight: bold; ">parameters</span><span style="color: #000000; ">:
        </span><span style="color: #000000; font-weight: bold; ">@class</span><span style="color: #000000; ">(</span><span style="color: #000000; ">TurtleMobility</span><span style="color: #000000; ">);
        </span><span style="color: #000080; font-weight: bold; ">bool</span><span style="color: #000000; "> </span><span style="color: #000000; ">debug</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// debug switch
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">xml</span><span style="color: #000000; "> </span><span style="color: #000000; ">turtleScript</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// describes the movement
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">double</span><span style="color: #000000; "> </span><span style="color: #000000; ">updateInterval</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">s</span><span style="color: #000000; ">); </span><span style="color: #808080; font-style: italic; ">// time interval to update the hosts position (in seconds)
</span><span style="color: #000000; ">}



</span></pre>
   <hr><p class="footer"><a href="http://creativecommons.org/licenses/by-sa/3.0" target="_top"><img src="by-sa.png"></a> This documentation is released under the <a href="http://creativecommons.org/licenses/by-sa/3.0" target="_top">Creative Commons license</a></p>
   </body>
</html>
